Data coding system and method

ABSTRACT

A data coding system that compresses data and enables data, e.g., prefix addresses, to be represented with significantly fewer memory cells when compared to conventional coding systems.

RELATED APPLICATIONS

This application is a divisional of U.S. patent application Ser. No.10/964,283 filed on Oct. 12, 2004 which claims priority to U.S.provisional application Ser. No. 60/510,761 entitled “Memory And PowerEfficient Content Addressable Memory for General Classification” filedon Oct. 11, 2003, which are all incorporated by reference herein intheir entirety.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates generally to data coding systems.

2. Description of Background Art

A Content Addressable Memory (CAM) has a number of storage locations inwhich data can be stored. Once data is stored in a location, thelocation can be addressed using the content (data value) of thelocation. An input word is compared against a table of allowed values.If there is a match, the location of the matched word is returned. Thelocation is typically used to address a related table and acorresponding word is returned. One application of CAMs is in internetprotocol (IP) packet classification where IP addresses and other fieldsof an internet packet are compared in network switches and routers. In acommon form of IP addresses, called a subnet address or an addressprefix, definite values are specified for a certain number of bits andthe rest of the bits of the address are specified as “x” (don't care)bits. An example for IPv4 addresses is given below: 0110 1100 0111 xxxxxxxx xxxx xxxx xxxx

The bits that are not x (don't care) form the prefix of the address, andthe number of prefix bits is called prefix length. A subset of theclassification application is to identify the matching prefix that hasthe longest number of prefix bits. In the more general classificationapplication, several fields must match simultaneously. An examplespecification for classification is shown in the table of FIG. 19.

Additional fields may be used in the classification, for example 144bits of specification can be used for Internet Protocol version four(IPv4) classification. In Internet Protocol version six (IPV6), thelength of each address field is 128 bits long, and a classificationspecification can exceed 576 bits. A key characteristic ofclassification specifications is that each of the fields can have x(don't care) bits. Thus CAMs for classification must permit x (don'tcare) bits that are not necessarily contiguous. A class of CAMs calledternary CAMs has been introduced to address this need, where there is anextra bit associated with every data bit, called the mask bit.

There are many disadvantages with the conventional ternary CAMstructure, however. Since each cell contains two memory cells, and amask-and-compare circuit, implementation of a table of size w×2^(n)requires w×2^(n+1) memory elements, and w×2^(n) mask-and-comparecircuits. Since every lookup in the table requires the activation of allthe cells, power consumption is proportional to w×2^(n). For largevalues of n, the cost is considerable, and the power consumption isprohibitive. In addition, since the comparison logic is repeated inevery cell, it is expensive and difficult to provide different kinds ofcomparison, and the typical CAM provides only bit-for-bit compares.

What is needed is a data coding system that compresses data and enablesdata, e.g., prefix addresses, to be represented with significantly fewermemory cells when compared to conventional coding systems.

SUMMARY OF THE INVENTION

A data coding system is disclosed that compresses data and enables data,e.g., prefix addresses, to be represented with significantly fewermemory cells when compared to conventional coding systems.

Embodiments of the invention can be implemented in a content-addressablememories suitable for Internet packet classification that reduces thecost to a little more than one memory element per bit. The presentinvention makes possible significant power savings even with much largerCAM tables. The preferred embodiment provides a wide range of lookupfunctions within a single structure. The range of options can beexploited during the design stage (architectural scaling), duringmanufacture of chips (mask programmability), before the CAM is put intoa particular use (field programmability), between cycles of CAMprogramming (re-programmability), or even between cycles of CAM usage(re-configurability). One embodiment of the present invention permitsdifferent kinds of comparison, including bit-for-bit and range compares.In other embodiments, different types of comparison can be mixed in thesame CAM word or different CAM entries can be subject to different kindsof compares.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a conventional CAM system.

FIG. 2 shows a conventional ternary CAM array.

FIG. 3A is a block diagram of a CAM according to one embodiment of thepresent invention.

FIG. 3B is a block diagram of a system using a CAM according to oneembodiment of the present invention.

FIG. 3C is a flow chart of the Control Phase technique according to oneembodiment of the present invention.

FIG. 3D is a flow chart of the Data Phase technique according to oneembodiment of the present invention.

FIG. 4 is an example table of CAM entries.

FIG. 5 shows an example of how CAM entries can be split into groupsaccording to one embodiment of the present invention.

FIG. 6 shows configuration values for the first group shown in theexample set forth in FIG. 5 according to one embodiment of the presentinvention.

FIG. 7 shows an Entry Select Circuit based on ternary CAM bits accordingto one embodiment of the present invention.

FIG. 8 illustrates how entries can be grouped so that x (don't care)values are not required in the Entry Selector according to oneembodiment of the present invention.

FIG. 9 shows a coding scheme to represent prefix specificationsaccording to one embodiment of the present invention.

FIG. 10 shows a compressed specification for the third group of FIG. 8according to one embodiment of the present invention.

FIG. 11 is an example Entry Selection Table according to one embodimentof the present invention.

FIG. 12 is an example of an Entry Selection Table that is split intofour segments according to one embodiment of the present invention.

FIG. 13 shows the logical operation of a 2-stage Entry Selectoraccording to one embodiment of the present invention.

FIG. 14 is an example of 2-stage Entry Selector implementation accordingto one embodiment of the present invention.

FIG. 15 shows a Bit Selector circuit according to one embodiment of thepresent invention.

FIG. 16 shows the sequence of steps in selecting bits from an inputaccording to one embodiment of the present invention.

FIG. 17A shows an overlapped bit select circuit according to oneembodiment of the present invention.

FIG. 17B shows how segments of the overlapped bit select circuit areconnected according to one embodiment of the present invention.

FIG. 18 shows the sequence of steps in selecting bits with an overlappedbit select circuit according to one embodiment of the present invention.

FIG. 19 shows the format of an example classification specificationaccording to one embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Embodiments of the present invention are now described with reference tothe figures where like reference numbers indicate identical orfunctionally similar elements. Also in the figures, the left mostdigit(s) of each reference number correspond(s) to the figure in whichthe reference number is first used.

FIG. 1 illustrates a typical system with a CAM. An input word of width w(101) is compared against a table of allowed values (102.) If there is amatch, the location of the matched word (103) is returned. The locationis typically used to address a related table (104) and a correspondingword (105) is returned.

FIG. 2 shows a conventional ternary CAM array. The data is stored in theData Register D (201) and the mask is stored in the Mask Register M(202). During a compare the value to be compared is placed on the columnlines Col (203). The Compare circuit C (204) compares the data values tothe Col line values, and transfers the result of the compare to theMatch lines (205), if the value of the Mask Register indicates that thedata bit is valid for comparison. The cell 206 is arrayed w times toform a row of width w (207), and the row is arrayed 2^(n) times to formthe table. Since multiple rows may match a given input, a PriorityCircuit (208) is used to select one of the match lines.

The block diagram of FIG. 3A illustrates a CAM (300) with a capacity ofN×n entries, according to one embodiment of the present invention. Thereare N blocks, Block-1 (320) through Block-N (321.) Within each blockthere is a Specification Memory 301 which can store up to n entries. TheEntry Bit Select circuit 302 selects certain bits from the input word303 of width w. The Entry Select circuit 305 uses the selected bits 304,of width sw, to select one of the n entries from the SpecificationMemory. The selected entry, output on 306, is optionally modified by theInterpretation circuit 307 and output on 308. The input 303 isoptionally modified by the Compare Gate and Modify circuit 316 andoutput on 310. The Compare circuit 309 compares 308 against 310, andindicates whether the input matched the selected entry on Match line311. The address of the selected entry within the block is output asAddr 312. There are N match indicators, one from each of the N blocks,one of which is selected by the Priority Circuit 313, whose output Match315 is set if at least one of the blocks indicates a match. The outputSelected Address 314 combines the identity of the group selected by thePriority Circuit and the address of the matching entry within thatblock.

The CAM 300 can be used in a system as illustrated in FIG. 3B. In oneembodiment, there are two phases to the use of the CAM 300: a ControlPhase during which the CAM 300 is loaded with entries, and a Data Phaseduring which the CAM 300 compares input values against the storedentries and returns the result. The Supervisory Processor 331 is chargedwith loading the configuration registers and memories of the CAM 300with entries. Once it is loaded, the CAM 300 operates independently inthe Data Phase where it accepts input 303, compares it against theentries, and returns the resulting Match indicator 315 and the SelectedAddress 314.

The goal in the Control Phase is to load the CAM 300 in such a way thatonly one entry in each Block of the CAM can possibly match any giveninput. One way to accomplish the goal is illustrated by the sequence ofsteps illustrated in FIG. 3C. The starting point 350 is a table with upto N×n entries. In the first step 351, the entries are separated into upto N groups, each with no more than n entries, in such a way that withineach group no more than one entry can match any given input. The nextthree steps are repeated, once for each group formed in step 351. Instep 352, the entries of the group are loaded into the SpecificationMemory 301 of a new Block in the CAM 300. In step 353, certain bitspositions are selected for the group so that the values of the selectedbit positions are sufficient to distinguish a single entry from the restof the entries in that group. In the next step 354, the Entry Bit Select302 is configured with the bit positions selected in step 353. Then inStep 355 the Entry Select 305 is configured so that it has thedistinguishing bits of entries in locations corresponding to thelocations of the entries in the Specification Memory 301.

The goal of the Data Phase is accomplished by the CAM 300. Each block ofthe CAM 300 acts as illustrated by the flow chart of FIG. 3D. In step361, the bit positions configured into the Entry Bit Select are readfrom the input 303. In step 362, the Entry Select 305 selects at most asingle entry based on the bit values read in step 361. In the followingstep 363, the selected entry is read from the Specification Memory 301.In the optional step 364, the value from the specification memory ismodified by Interpretation circuit 307, and/or the input is modified bythe Compare Bit Select and Interpret Circuit 316. In step 365, theCompare circuit 309 compares the optionally modified values from step364 against each other, and outputs the result. In step 366, thePriority Circuit 313 selects one of the results from all the blocks, andoutputs the selected result.

The operation of the CAM 300 can be illustrated with the example tableof CAM entries shown in FIG. 4. The example table has 20 entries of 13bits each, with each bit having 3 possible states, 0, 1, and x. Thetable can be split into groups of five entries or less, as shown in FIG.5, so that only one entry from the group can possibly match any giveninput. Within each group, a few bits are sufficient to distinguishuniquely between the entries, and these bits are shaded (highlighted).There may be more than one way to group the entries, and there may bemore than one set of distinguishing bits. For the purposes of variousembodiments of the present invention, the particular choice of groups orbits does not matter. The Entry Bit Select circuit 302 is configured sothat the highlighted bits in each group are automatically selected asinput into the Entry Select circuit 305. The potential outputs of theEntry Bit Select 302 are shown in the table of FIG. 5 as SB0, SB1, SB2,and SB3. The acceptable values of SB0-3 for a group are loaded into theEntry Select 305. The group entries are loaded into the SpecificationMemory 301 at the same location that the selected bits for that entryare found in the Entry Select 305. If the input value of SB0-3 matchesone of the acceptable values, the corresponding entry in thespecification memory is selected and is output as a potential match onlines 306. In this example, the Interpretation circuit 307 is configuredto not modify the output, and the Compare Gate and Modify circuit 316 isconfigured to output all input bits, so the selected entry is compareddirectly against the input word. FIG. 6 shows the configuration andvalues for the first group, and the results of an example input. TheEntry Bit Selector 302 selects Bits 0, 5, 6, 12 as inputs to the EntrySelect Circuit 305. The selected bits match the 2^(nd) entry of theEntry Selector 305. The 2^(nd) entry of the Specification Memory 301 isread out, and compared against all bits of the input 303, resulting in amatch.

Embodiments of the present invention are an improvement overconventional CAMs because the Specification Memory blocks are memoryarrays composed of pure RAM cells (not conventional ternary CAM cells).The size of a RAM cell is smaller than a CAM cell. In the case of staticRAM technology, the pure RAM cell can be one-third to one-fifth the sizeof a ternary CAM cell. The size can be reduced even further by usingDRAM or 1-T SRAM technologies, so the memory cells used in embodimentsof the present invention can be less than one-tenth the size of the CAMcell. Thus the size of a CAM implementation will be much smaller (⅓ to1/10 the size) than an equivalent size of a conventional CAM. Thus, in agiven size of silicon, a CAM according to the present invention can havetables that are three to ten times larger, compared to conventionalCAMs. The cost per bit for the present invention can be in excess of 10times less expensive.

In a conventional CAM, a comparator circuit is built into each cell ofthe array. So each input activates as many comparator circuits as thereare bits in the CAM. In the embodiments of the present invention, thereis only one entry-wide comparator per group, apart from the few narrowercomparators used in the Entry Select circuit. Thus the power consumptionfor the computation of a match is also reduced by a factor approachingthe size of the group.

An aspect of one embodiment of the present invention that distinguishesit from conventional CAM devices is the separation of memory elementsfrom the computation/compare elements. This separation permits the twoelements to be independently optimized for power and cost. For example,the comparators used in embodiments of the present invention can usemore sophisticated power management techniques since the complexity isamortized over the large number of elements in every block. As anotherexample, the memory blocks can utilize lower voltage swings withoutbeing constrained by the requirements of the comparators.

Since the implementation size and the power consumption are much smallerthan conventional CAMs, the embodiments of the present invention aremuch more amenable to integration. Not only can much larger CAM tablesbe integrated on a single die, but also very large CAM tables can beintegrated on the same die with complex logic functions such NetworkProcessors, Traffic Managers, and Security chips. By separating thecompare function from the memory in the CAM, more complex comparefunctions (e.g. range compare) can be implemented without significantadditional cost.

In the Control Phase, there are a variety of ways to accomplish thegrouping of entries. The most efficient way to group the entries willdepend on the characteristics of the table of entries. For example, ifthe entries do not have any x (don't care) values, the task of findingentries that are eligible to belong to a group is straight-forward sinceall entries are by definition unique and so any given input can onlymatch a single entry regardless of how the entries are grouped. This isthe case for several tables common in networking, including what arecalled flow tables in networking parlance. In the typical forwardingtable used in networking applications, the table entries have the formof prefix addresses and thus have x (don't care) bits that arecontiguous. This case can be handled in a number of ways, for examplewith a strategy of grouping entries by the number of x (don't care) bitsin them. In the more general classification case, it may be necessary toadopt more complex strategies. For example, the entries may be groupeddeterministically using a two pass approach. During a first pass, thedata is organized into a tree with three potential branches from eachnode. In a second pass the tree can be traversed in a variety of ways toform the groups. An idea that works well in the tree traversal is ateach node that has both a 0-branch and a 1-branch to pick one entry fromthe 0-branch and one entry from the 1-branch. The two entries chosen inthis way are guaranteed to not match simultaneously since they differ inthat bit position. Another option is to use statistical information, forexample regarding IP addresses, to identify the bit positions used todistinguish the data in each group. In this technique, the flow chartwill differ from FIG. 3C in that the distinguishing bit positions arechosen first and then the groups are formed. In this technique, it isnot required that the same set of bit positions be used for all groupsin the CAM; one set may be used until distinction between remainingentries becomes difficult, and then another set can be used. A variationof this technique is to select the set of distinguishing bit positionsat random. This works well when dealing with large tables with a gooddistribution of values within the table.

The selection of entries for a group also has a bearing on thedistinguishing bit positions for that group, and hence on the number ofbit positions chosen for the Entry Selector 305. Though the EntrySelector can be designed to handle any number of bit positions, thelogic can be simplified if the Control Phase chooses a minimal number ofdistinguishing bit positions for each group. The smallest number ofdistinguishing bit positions is log₂ of the number of entries in thegroup, and the largest necessary is one less than the number of entriesin the group. The tree traversal technique, as well as the technique ofchoosing the bit positions (at random or with a-priori statisticalknowledge) before choosing the groups, can help select minimal numbersof distinguishing bit positions.

Another consideration in the grouping of entries and selection of bitpositions is whether x (don't care) values are permitted in thedistinguishing bit positions for any group. Implementation of the EntrySelect circuit can be simplified by not permitting x (don't care) valuesin the distinguishing positions. In this case, the Control Phase task isto group entries in such a way that distinctions between entries in eachgroup can be made by considering only those bit positions where thereare no x (don't care) values within that group. An example of thisstrategy is shown in FIG. 8, where the entries of the table of FIG. 4have been grouped so that x (don't care) values are not needed in theEntry Select.

An implementation of the Entry Select circuit 305 based on CAM bits isshown in FIG. 7. It uses a conventional CAM 701, of width sufficient tohold the selected bits. The depth of the table is equal to the number ofentries in a group. The selected bits 702 choose at most one of theentries, and the CAM will return a pointer 703 to the selected-bit-basedentry specification that matched. Since not all entries in a group maybe defined (as in Group 4 of FIG. 5) a valid bit 704 is appended to eachselection criterion. The valid bit can be set to invalid when there isno entry at that location. The CAM cells used in this implementationwill need to be ternary if x (don't care) values are permitted in thedistinguishing bits as in FIG. 5, but can be binary if x (don't care)values are not permitted as in FIG. 8.

The size of the Entry Select circuit 305 can be reduced further by usinga multi-stage technique. FIG. 11 shows an example of Entry Selectinformation where 8 selected bits are used to select among 16 entries.In FIG. 12 the information has been split into four segments accordingto the magnitude of the number formed by the bits. A few of the bits,shaded in gray, are used to distinguish between entries. Entry selectionis done in two stages. In the first stage, all the selected bits SB0-7are used to decide which segment applies, and in the second stage someof the SB0-7 bits are used to select an entry within the segment. FIG.13 shows the logical operation of a 2-stage Entry Select 305. FIG. 14shows an example implementation. The selected bits Sell are used by aMagnitude Comparator array 1401 to select one row of memory containinginformation on discriminating bits for stage 2 (1402) and an addressoffset 1403 into a CAM 1404 of second-stage bit values. The informationof the bits needed for the second stage is directed to the second BitSelect circuit 1405, which picks out the appropriate bits to provide asinput to the CAM. Single-stage selection would have required a 16×8 CAMfor the example table of FIG. 11. The 2-stage selector implementation ofFIG. 12 requires three 8-bit magnitude-comparators, and a 16×3 CAM. Insome cases the CAM can be replaced by a decoder. Multi-stage circuitswill reduce the implementation cost, particularly when the group size islarge and there are many bits in the entry selector, trading off latencyfor transistor efficiency.

In the case where the Control Phase can ensure that the number of bitsselected is exactly equal to log₂ of the group size, the Entry Selectcircuit can be simplified to a simple decoder.

FIG. 15 shows an example implementation of the Bit Select circuit. Thebits in the input 1501 to be selected are indicated by a ‘1’ value inthe selection register SEL 1502. When a load is signaled, selected bitsare loaded into the shift register 1503. In this example, there are twobits in each shift register cell, F/E 1505 indicating whether the shiftregister bit is full or empty, and VAL 1506 indicating the value if itis full. Thus, when a bit is loaded, the corresponding F/E bit is set to‘full’. All other F/E bits are set to ‘empty’. When the load iscompleted, the shift register is activated for shifting. Shifting isaccomplished in a series of steps. In each step, the shift registermoves values from a ‘full’ location to the adjacent location on theleft, if it is ‘empty’. On completing such a move, the original locationis set to ‘empty’ and the new location is set to ‘full’. Shiftingcontinues until no more shifts are possible. The Shift Control circuit1507 uses the value of the F/E bit from the current location and theprevious location to make the decision on whether a move is permitted,and is responsible for setting and resetting the F/E bit at both thecurrent and the previous location. The sequence of steps for an examplebit selection is shown in FIG. 16. By the final step (Step 5), all theselected bits are positioned at the leftmost bits, and the bits aredirected to the output lines SBit 1504 by the Out signal. If the shiftregister is asynchronous, all the steps may be completed in one cycle ofthe CAM.

The worst case number of steps required to shift the relevant bits tothe most significant bits can be reduced by using the scheme of FIG. 17.The shift register length is divided into two or more segments, each oflength sw bits, as shown in FIG. 17B. The output 1701 of the left-mostbit of each shift register is connected to the input 1702 of right-mostbit to form a circular shift register. An additional bit POS 1703 isused to indicate the final position of the shifted bits in each segment.During the shift process, no shifts are permitted from a bit with POS=1to a bit with POS=0. The shift control for any location considers thePOS value, as well as the F/E value, of the current location and theprevious location. The segments are overlapped so that the output fromthe first bit of each segment 1704 is connected to the first bit of thebit selector output S-Bit1 1705. Similarly, 2^(nd) bit outputs from allsegments is connected to SBit-2, and so on. The POS bits are configuredso that the POS bit for only one segment is set to 1 for any given SBitlocation; and so that in any given segment all POS bits are contiguous.Once the shift registers of the segments are loaded from the inputs, thecircular shift begins, and by the last step all selected bits will bepositioned so that they are properly aligned from the leftmost SBit.Since circular shift registers are used, the order of the selected bitsmay be different from the original input. FIG. 18 shows the sequence ofsteps. When the shifting is complete, as shown in step 2, the twocircular registers have their full bits aligned so that there is nooverlap, and the values can be loaded onto to the output lines. Thevalue is output only if the POS bit is set for that location. Byoverlapping, the time to complete the bit selection procedure isreduced, in this example, from 5 steps to 2 steps. When the length ofthe segment is shorter than the number of selected bits, additionalconfiguration bits are required to direct the shifted values in eachsegment to the appropriate output line.

In a conventional CAM, the interpretation of the values of the memorycells in the CAM is constrained by the logic in the CAM cell. Thus in atypical ternary CAM cell, one memory cell is always interpreted as amask, indicating whether the value is x (don't care) or not, and theother memory cell is interpreted as the non-x value. Embodiments of thepresent invention separate the interpretation function from the memoryin the CAM, thus allowing many options for what kind of values arestored in the Specification Memory 301. These options include, but arenot limited to, binary, ternary, range specifications, and compressedspecifications. In the case of binary specification, w bits of memorycan be used for a w-bit sized input. In the case of ternaryspecification, 2w bits of memory can be used for a w-bit sized input.For range specification, it is possible to define two fields as definingthe start and end of a range, or a start and a count is another way ofdefining a range. It is also possible to define range fields that havethe form greater than, or less than, etc.

Many representations of compressed fields are possible. As an example,subnet address fields (also called prefix addresses) of width w bitsrequires 2w memory cells in standard ternary CAMs, but by using thecoding scheme shown in FIG. 9, it is possible to represent prefixaddresses of w bits with just w+1 bits in embodiments of the presentinvention. The additional bit is appended to the end of the w bits, andis used to indicate if the previous bit should be compared or not. Ifthe bit is not to be compared, then the value of the bit indicateswhether the next bit is to be compared. This process continues until abit indicates that the next bit is to be compared. After that point allbits are compared. It is also possible to reduce memory requirements bygroup entries in such a way that the specification of mask bits(specifying which bits to compare) is common to the whole group. Boththese techniques are used in FIG. 10, which uses the third group of FIG.8 as an example. The Specification Memory 1001 has no x values, but hastwo new bits X1, and X2, which are associated with prefixes Bits 0-4,and Bits 5-9. The Interpretation circuit 1002 is designed to recognizethese fields as prefix values. In addition, since Bit 12 is ‘x’ for theentire group, the Interpretation circuit is configured to treat Bit 12as x (don't care). The Specification Memory can have arbitrary values inBit 12. The Interpretation circuit recreates the original entry from thecoded form, and the recreated entry is compared against the inputs bythe Compare circuit 1003.

With respect to the Interpretation techniques, of the present invention,there are a number of options available as potential embodiments of thepresent invention. The interpretation options are complementary to thecoding options in the Specification Memory. In addition to the optionsalready mentioned above, it is possible to include run-time errorchecking and error correction in this circuit. This is a function thatis very hard to provide in the typical ternary CAM. It is also possibleto vary the interpretation of the entries from entry to entry in thesame group if additional code bits are provided in the SpecificationMemory to indicate how the entry is to be interpreted. This may beuseful where the “meaning” of certain bits in the input changes with thevalue of certain other bits.

Various Compare Options (or other operations) are available for theimplementation of comparisons by circuit 309, including, but not limitedto, bit-for-bit compare, range compare, and various “soft” comparisons.Bit-for-bit compare is the standard CAM approach. Range compare ispossible to implement cheaply since, the range computation is done oncefor the group. Special forms of compare can allow tolerances in values,or permit computation of vector distances. This may useful in “soft”comparisons, such as voice prints, and images. In general, thecombination of options in the how bits are interpreted and the optionsin the compare block allow complex ALU-like functionality in embodimentsof the present invention. Since the logic used in performing these morecomplex operations is duplicated for every group, not every memory cell,the present invention supports more complex logic at a modest cost.

The examples shown so far use the entire input word in the CompareCircuit, so the Compare Gate and Modify circuit is optional. However, incertain embodiments of the present invention, this circuit can providefor additional useful functionality. For instance, it is possible tosteer fewer bits than the input into the Compare Circuit when, forinstance, bits used in the Entry Select Circuit need not be comparedagain. This will reduce the number of memory bits in the SpecificationMemory. It is also possible in this circuit to check whether certainconditions are met by the input before allowing any operation to proceedin the Block. This is particularly useful if during the Control Phase,all entries in a group are chosen so that all entries in that group meetcertain criteria. These criteria then can become gating criteriaenforced by the Compare Gate and Modify circuit. In this case, not allblocks of the CAM 300 will be activated during every compare, savingeven more power consumption.

As will be understood by those familiar with the art, the invention maybe embodied in other specific forms without departing from the spirit oressential characteristics thereof. Likewise, the particular naming anddivision of the modules, managers, features, attributes, methodologiesand other aspects are not mandatory or significant, and the mechanismsthat implement the invention or its features may have different names,divisions and/or formats. Furthermore, as will be apparent to one ofordinary skill in the relevant art, the modules, managers, features,attributes, methodologies and other aspects of the invention can beimplemented as software, hardware, firmware or any combination of thethree. Additionally, the present invention is in no way limited toimplementation in any specific programming language, or for any specificoperating system or environment. Accordingly, the disclosure of thepresent invention is intended to be illustrative, but not limiting, ofthe scope of the invention, which is set forth in the following claims.

1. A data coding method comprising the steps of: adding a first bit to afirst portion of a data entry having a length of w bits, determining afirst value representing the number of don't care (DC) bits that areadjacent to the first bit; setting the value of the first bit and eachadjacent bit that is a DC bit except for last DC bit, to indicate thatthe adjacent bit is a DC bit.